import { createStore } from 'vuex'

import { ref } from 'vue';


let Departments = ref([
  { department_ID: '01', label: "交通管理系" },
  { department_ID: '02', label: "安全管理系" },
  { department_ID: '03', label: "信息技术系" },
  { department_ID: '04', label: "智能制造系" },
  { department_ID: '05', label: "形象设计系" },
  { department_ID: '06', label: "职教/高中部" },
]);

let majors = ref([
  { label: "高铁航空服务", department_ID: '01', major_ID: '01' },
  { label: "城市轨道交通运输", department_ID: '01', major_ID: '02' },
  { label: "轨道车司机", department_ID: '01', major_ID: '03' },
  { label: "电力机车维修", department_ID: '01', major_ID: '04' },
  { label: "国防教育方向（计算机网络应用)", department_ID: '02', major_ID: '05' },
  { label: "消防工程技术", department_ID: '02', major_ID: '06' },
  { label: "特勤防爆方向（计算机网络应用）", department_ID: '02', major_ID: '07' },
  { label: "公安行政管理方向", department_ID: '02', major_ID: '08' },
  { label: "电子商务", department_ID: '03', major_ID: '09' },
  { label: "广告设计方向", department_ID: '03', major_ID: '10' },
  { label: "动漫设计方向", department_ID: '03', major_ID: '11' },
  { label: "AI智能制造", department_ID: '04', major_ID: '12' },
  { label: "SMT电子技术", department_ID: '04', major_ID: '13' },
  { label: "新能源汽车技术", department_ID: '04', major_ID: '14' },
  { label: "光电技术应用", department_ID: '04', major_ID: '15' },
  { label: "形象设计", department_ID: '05', major_ID: '16' },
  { label: "高考班", department_ID: '06', major_ID: '17' },
]);


const store = createStore({
  state: {
    departments: [],
    majors: []
  },
  mutations: {
    setDepartments(state, departments) {
      state.departments = departments;
    },
    setMajors(state, majors) {
      state.majors = majors;
    }
  },
  actions: {
    loadDepartments({ commit }) {
      commit('setDepartments', Departments.value);
    },
    loadMajors({ commit }) {
      commit('setMajors', majors.value);
    }
  },
  getters: {
    // 可以添加 getters
  }
});

export default store;

// export default createStore({
//   state: {
//     excel: 'http://127.0.0.1:6789/excel/'
//   },
//   mutations: {
//   },
//   actions: {
//   },
//   modules: {
//   }
// })
